package heven.holt.library.extensions

import android.content.res.Resources

fun Resources.getResourceIdByArray(arrayId: Int, position: Int): Int {
    val obtainTypedArray = obtainTypedArray(arrayId)
    val resourceId = obtainTypedArray.getResourceId(position, 0)
    obtainTypedArray.recycle()
    return resourceId
}

fun Resources.getStatusBarHeight(): Int {
    val resourceId = getIdentifier("status_bar_height", "dimen", "android")
    return getDimensionPixelSize(resourceId)
}

fun Resources.getNavBarHeight(): Int {
    val resourceId = getIdentifier("navigation_bar_height", "dimen", "android")
    return getDimensionPixelSize(resourceId)
}